<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            width: 200px;
            height: 200px;
        }
        
        .box1 {
            position: relative;
            background-color: #ccc;
            /* z-index: 5; */
        }
        
        .box1-son1 {
            position: relative;
            width: 150px;
            height: 150px;
            margin: auto;
            background-color: aqua;
            z-index: 999;
        }
        
        .box2 {
            position: relative;
            display: flex;
            margin: -100px 0 0 100px;
            background-color: blueviolet;
        }
        
        .box2-son1 {
            flex-shrink: 0;
            width: 100px;
            height: 100px;
            z-index: 9;
            background-color: green;
        }
        
        .box2-son2 {
            flex-shrink: 0;
            width: 100px;
            height: 100px;
            margin-left: -50px;
            z-index: 8;
            background-color: yellow;
        }
    </style>
</head>

<body>
    <div class="box1">
        盒子1
        <div class="box1-son1">
            盒子1的子盒子1
        </div>
    </div>
    <div class="box2">
        盒子2
        <div class="box2-son1">
            盒子2的子盒子1
        </div>
        <div class="box2-son2">
            盒子2的子盒子2
        </div>
    </div>
</body>

</html>